package org.airline.service;

import java.util.List;

import javax.annotation.Resource;

import org.airline.dao.IFlightArrangeDao;
import org.airline.entity.FlightArrange;
import org.airline.entity.PageBean;
import org.springframework.stereotype.Component;

@Component("FlightArrangeService")
public class FlightArrangeService implements IFlightArrangeDao{
	
	private IFlightArrangeDao iFlightArrangeDao;

	@Override
	public void FlightArrangInfoSave(FlightArrange flightArrange)
			throws Exception {
		//航班信息插入
		this.iFlightArrangeDao.FlightArrangInfoSave(flightArrange);
	}

	@Override
	public void deleteFlightArrangeInfoById(int id) throws Exception {
		//通过ID删除航班安排信息
		this.iFlightArrangeDao.deleteFlightArrangeInfoById(id);
	}

	@Override
	public List<FlightArrange> getAllFlightArrange() throws Exception {
		//查询航班安排信息
		return this.iFlightArrangeDao.getAllFlightArrange();
	}

	@Override
	public FlightArrange getFlightArrangeById(int id) throws Exception {
		//通过ID查询航班安排信息
		return this.iFlightArrangeDao.getFlightArrangeById(id);
	}

	@Override
	public void updateFlightArrangeInfo(FlightArrange fliArrange)
			throws Exception {
		//更新航班安排信息
		this.iFlightArrangeDao.updateFlightArrangeInfo(fliArrange);
	}

	public IFlightArrangeDao getiFlightArrangeDao() {
		return iFlightArrangeDao;
	}
	@Resource(name="FlightArrangeDaoImpl")
	public void setiFlightArrangeDao(IFlightArrangeDao iFlightArrangeDao) {
		this.iFlightArrangeDao = iFlightArrangeDao;
	}

	@Override
	public PageBean queryForPage(int pageSize, int page) throws Exception {
		return iFlightArrangeDao.queryForPage(pageSize, page);
	}

	// 根据安排时间查询前8条记录
	@Override
	public List<FlightArrange> getFlightArrangeByDate() throws Exception {
		return iFlightArrangeDao.getFlightArrangeByDate();
	}

	// 根据地点查询航班安排信息
	@Override
	public PageBean querySearchForSingle(int pageSize, int page,
			FlightArrange flightArrange) throws Exception {
		return iFlightArrangeDao.querySearchForSingle(pageSize, page, flightArrange);
	}

	@Override
	public PageBean queryForPageByKeyWords(String keyWord, int pageSize,
			int page) throws Exception {
		return iFlightArrangeDao.queryForPageByKeyWords(keyWord, pageSize, page);
	}

}
